#ifndef SIGNALSERVICE_H
#define SIGNALSERVICE_H

#include "../global.h"
#include <boost/function.hpp>
#include <boost/asio/signal_set.hpp>
#include <boost/system/error_code.hpp>

class AsyncService;

class SignalService : protected boost::noncopyable
{
public:
    typedef boost::asio::signal_set SignalSet;
    typedef boost::system::error_code ErrorCode;

    typedef boost::function< void (int) > Notifier;

public:
    SignalService(AsyncService &service);
    ~SignalService();

    int  addSignal(int signalNumber);

    void wait(BOOST_ASIO_MOVE_ARG(Notifier) n);

protected:
    void onSignal(Notifier n, const ErrorCode &ec, int signalNumber);

protected:
    SignalSet m_signalSet;
};

#endif // SIGNALSERVICE_H
